package com.lunatic.rocketmq.service;

import com.lunatic.rocketmq.model.DemoMessage;
import lombok.extern.log4j.Log4j2;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

@Log4j2
@Service
@RocketMQMessageListener(
        consumerGroup = "demo_consumer_group",
        topic = "tx-demo-topic",
        consumeMode = ConsumeMode.CONCURRENTLY
)
public class TxConsumer implements RocketMQListener<DemoMessage> {

    @Override
    public void onMessage(DemoMessage demoMessage) {
        log.info("消费事务消息： {}", demoMessage);
    }
}
